package com.yunhuajinfu.fragment;

import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.yunhuajinfu.R;
import com.yunhuajinfu.base.BaseFragment;
import com.yunhuajinfu.base.ViewPagerIndicatorAdapter;
import com.yunhuajinfu.mian.MainActivity;
import com.yunhuajinfu.view.TitleBar;
import com.yunhuajinfu.view.XViewPagerIndicator;

import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * 投资
 */
public class FinancialFragment extends BaseFragment{

    @Bind(R.id.titlebar)
    TitleBar titlebar;
    @Bind(R.id.id_stickynavlayout_indicator)
    XViewPagerIndicator mViewPagerindicator;

    @Bind(R.id.id_stickynavlayout_viewpager)
    ViewPager mviewPager;
    //
    private MainActivity activity;
    private View view;

    //
    private String[] titles = { "电商贷", "信用贷","抵押贷","质押贷"};
    private List<Fragment> fragments = new ArrayList<Fragment>();
    private ViewPagerIndicatorAdapter mviewPagerIndicatorAdapter;

    //
    private XinyongFragment mXinyongFragment;
    private  DiYaFragment mDiYaFragment;
    private  DianShangFragment mDianShangFragment;
    private  ZhiYaFragment mZhiYaFragment;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        view = inflater.inflate(R.layout.fragment_financial, container, false);
        activity = (MainActivity) getActivity();
        super.onCreateView(inflater, container, savedInstanceState);
        ButterKnife.bind(this, view);
        return view;
    }
    @Override
    protected void initTitle() {
        titlebar.setTitleBar(0,"我要投资",0);
    }

    @Override
    protected void initView() {
        mDianShangFragment=new DianShangFragment();
        mXinyongFragment =new XinyongFragment();
        mDiYaFragment=new DiYaFragment();
        mZhiYaFragment=new ZhiYaFragment();
        //
        fragments.add(mDianShangFragment);
        fragments.add(mXinyongFragment);
        fragments.add(mDiYaFragment);
        fragments.add(mZhiYaFragment);
        mviewPagerIndicatorAdapter=new ViewPagerIndicatorAdapter(activity.getSupportFragmentManager(),fragments);
        mViewPagerindicator.setIndicatorColor(Color.BLUE);
        mviewPager.setAdapter(mviewPagerIndicatorAdapter);
        mViewPagerindicator.setTitles(titles, mviewPager);
        mViewPagerindicator.setIndicatorColor(getResources().getColor(R.color.bule));

    }

    @Override
    protected void setData() {

    }

    @Override
    protected void widgetClick(View view) {

    }


}
